package com.study.cloud.controller;

import com.study.cloud.gateway.client.core.ApiInvoker;
import com.study.cloud.gateway.client.core.ApiProtocol;
import com.study.cloud.gateway.client.core.ApiService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wangwancheng
 * @create 2025/7/19 11:14
 */
@ApiService(serviceId = "backend-http-server", version = "1.0.0", protocol = ApiProtocol.HTTP,patternPath = "/http-server/**")
@RestController
@Slf4j
public class HelloController {

    @ApiInvoker(path = "/http-server/ping")
    @GetMapping("/http-server/ping")
    public String ping() {
        try {
            Thread.sleep(10*1000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        log.info("pong===================");
        return "pong";
    }
}
